feat: add documents table for Git-backed Headless CMS#34
Merged
pyramation merged 7 commits intomainfrom Apr 30, 2026
Merged
Conversation
Add a documents blueprint schema for version-controlled markdown files with SearchUnified (embedding + BM25 + chunks), repo/path/commit tracking, and frontmatter metadata support. - New documents.ts schema: documents table with chunked embeddings - Junction tables: company_documents, project_documents - BM25/btree/GIN indexes for content, repo_name, file_path, tags - Registered in provision.ts orchestrator (before cross-relations)
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Make the documents table format-agnostic instead of forcing markdown.
DataId is added automatically; ORG_NODES import removed.
…thand - Remove ORG_NODES constant from blueprint.ts (DataId is automatic) - Replace all ...ORG_NODES spreads with 'DataTimestamps' string shorthand - Clean up ORG_NODES imports from all schema files - BlueprintNode union type supports plain string shorthand natively
… CLI - Add 'DataId' node to all schema files (required for PK constraint creation) - Run provision: all 11 schemas (including Documents) applied successfully - Run export:pgpm: SQL migrations generated in packages/agentic-db/ - Run generate:all: GraphQL schema, ORM SDK, and CLI regenerated - Documents table includes SearchUnified (embedding + BM25 + chunks) - Junction tables: company_documents, project_documents
5 tasks
SearchUnified already creates a BM25 index on embedding_text (which includes content via source_fields). The explicit content BM25 index caused duplicate filter/score fields in the GraphQL API and double-counted content relevance in the composite searchScore. Removed from: - documents.ts: content BM25 index - crm.ts: notes content BM25 index Re-provisioned and regenerated all output.
…export feat: provision + export documents table with generated SQL, SDK, and CLI
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
documentsblueprint schema for version-controlled files (Git-backed Headless CMS primitive) and removes theORG_NODESabstraction across all provision schemas.1. Documents table (new)
New schema file:
packages/provision/src/schemas/documents.tsdocumentstable with fields:title,content,metadata(jsonb),repo_name,file_path,commit_hash,tagsSearchUnifiednode withchunks: {}for automatic chunking (generatesdocuments_chunkstable, likenotes_chunks)content, GIN index ontags, btree indexes onrepo_nameandfile_pathJunction tables (via
cross-relations.ts):company_documents— link documents to companiesproject_documents— link documents to projectsOrchestrator (
provision.ts):Documentsschema registered beforeCross-Relations2. Remove ORG_NODES, use string shorthand (cleanup)
ORG_NODESconstant fromblueprint.ts—DataIdis added automatically,DataTimestampsdoesn't needinclude_id: false...ORG_NODESspreads with'DataTimestamps'string shorthand (theBlueprintNodeunion already supports plain strings natively)ORG_NODESimports from all 8 schema filesReview & Testing Checklist for Human
pnpm run provisionto verify documents table + chunks + junctions are created'DataTimestamps'shorthandpnpm run export:allto regenerate SQL module and SDK/CLINotes
Link to Devin session: https://app.devin.ai/sessions/2a4faca18f1a4b4aaf3d8e1162f67e0d
Requested by: @pyramation